#include<iostream>
#include<stdio.h>
#include<cstdlib>
#include<sys/time.h>
#include"GRAPH.h"
#include"GRMAT.h"
using namespace std;

int main(int argc,char *argv[])
{
  int N=2000; 
  int a[N][N] , b[N][N] , c[N][N];
  int i , j , k;
  // Setting all entires of matrix A by i*j
  for( i = 0 ; i < N ; i++)
    for( j = 0 ; j < N ; j++)
      a[i][j]=i*j;
  // Setting all entires of matrix B by i+j
  for( i = 0 ; i < N ; i++)
    for( j = 0 ; j < N ; j++)
      b[i][j]=i+j;
  // Multiplying Both matrices
  timeval tim;
  gettimeofday(&tim, NULL);
  double t1=tim.tv_sec+(tim.tv_usec/1000000.0);	   
  for( i = 0 ; i < N ; i++)
    for( j = 0 ; j < N ; j++)
      {
	c[i][j] = 0;
	for( k = 0 ;k < N ; k++)
	  c[i][j] += a[i][k]*b[k][j];
      }
  gettimeofday(&tim, NULL);
  double t2=tim.tv_sec+(tim.tv_usec/1000000.0);
  printf("%.6lf seconds elapsed\n", t2-t1);
  /*
  cout<<"The resultant matrix is:\n";
  for( i = 0 ; i < N ; i++)
    {
      for( j = 0 ; j < N ; j++)
	cout<<c[i][j]<<" ";
      cout<<endl;
    }
  */
  return 0;
}
